package vcp.models;

import client.Message;
import control.SimpleClient;
import db.parking.beans.rates;
import vcp.common.AbstractModel;



/**
 * Rates Management Model
 *
 */
public class RatesManagementModel extends AbstractModel {

	/**
	 * get Rates request
	 */
	public void getRates() {
		client = SimpleClient.getInstance();
		client.addPropertyChangeListener(this);	
		Message msg = new Message(null,"GetRates");
		 try {
				client.sendToServer(msg);				
		 }
		 catch (Exception ex)
		    {
			 System.out.println(ex.toString()+"Insert->GetRates");
		    }
	}

	/**
	 * save rate request
	 * @param bean
	 */
	public void saveRate(rates bean) {
		client = SimpleClient.getInstance();
		client.addPropertyChangeListener(this);	
		Message msg = new Message(bean,"SaveRate");
		 try {
				client.sendToServer(msg);				
		 }
		 catch (Exception ex)
		    {
			 System.out.println(ex.toString()+"Insert->SaveRate");
		    }
		
	}
	
	/**
	 * get rates by lot number request
	 * @param lotNum
	 */
	public void getRatesByLotNum(int lotNum) {
		client = SimpleClient.getInstance();
		client.addPropertyChangeListener(this);	
		Message msg = new Message(lotNum,"GetRatesByLotNum");
		 try {
				client.sendToServer(msg);				
		 }
		 catch (Exception ex)
		    {
			 System.out.println(ex.toString()+"Insert->GetRatesByLotNum");
		    }
	}

	/**
	 * modify temporary cell request
	 * @param bean
	 */
	public void modifyTempRateCell(rates bean) {
		client = SimpleClient.getInstance();
		client.addPropertyChangeListener(this);	
		Message msg = new Message(bean,"ModifyTempRateCell");
		 try {
				client.sendToServer(msg);				
		 }
		 catch (Exception ex)
		    {
			 System.out.println(ex.toString()+"Insert->ModifyTempRateCell");
		    }
		
	}
	
}
